#pragma once

#include "space\base_compat.h"
#include "space\helpers.h"
#include <string>

namespace space {

	class i_bit {
	public:

		~i_bit() {}
		virtual i_bit * pointer(void) = 0;
		
		//DECLARE_GET_MEMBER(std::string, name);
		//DECLARE_GET_MEMBER(u_int64, id);
	};
	typedef shared_ptr<i_bit> i_bit_ptr;

	template <class T>
		class bit : public i_bit {
	public:
		template< class T >__inline const std::type_info& type( T& object ) { return typeid(object); }
		template< class T >__inline const std::type_info& type( const T& object ) { return typeid(object); }
		template< class T >__inline T pointer( void ) { return this; }
		__inline bit * pointer( void ) { return this; }
		
		bit(u_int64 id, std::string name) :
			_name(name),
			_id(id) 
		{}
		bit(std::string name) :
			_name(name)
		{ _id = unique_id(); }
		bit(u_int64 id) :
			_id(id) 
		{}
		bit() :
			_name("")
		{ _id = unique_id(); }

		DECLARE_MEMBER(u_int64, id);
		DECLARE_MEMBER(std::string, name)
	};
	
};